package com.seecen.HJM.controller;

import com.seecen.HJM.model.dto.PlayListBindingDTO;
import com.seecen.HJM.model.dto.PlaylistGetSongDto;
import com.seecen.HJM.model.entity.Song;
import com.seecen.HJM.result.DataVo;
import com.seecen.HJM.result.PageResult;
import com.seecen.HJM.service.PlaylistBindingService;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/playlist-binding")
public class PlaylistBindingController {
    @Autowired
    private PlaylistBindingService playlistBindingService;
    //添加歌曲进歌单
    @PostMapping("/addSongsToPlaylist")
    public DataVo addSongsToPlaylist(@RequestBody PlayListBindingDTO dto){
        return playlistBindingService.addSongsToPlaylist(dto);
    }

    //删除歌曲进歌单
    @PostMapping("/removeSongsFromPlaylist")
    public DataVo removeSongsFromPlaylist(@RequestBody PlayListBindingDTO dto){
        return playlistBindingService.removeSongsFromPlaylist(dto);
    }

    @PostMapping("/getSongsByPlaylistId")
    public DataVo<PageResult<Song>> getSongsByPlaylistId(@RequestBody @Valid PlaylistGetSongDto playlistGetSongDto)  {

        return playlistBindingService.getSongsByPlaylistId(playlistGetSongDto);
    }
}
